<!--<?php
require_once template('header'); 
print <<< EOT
<!--右边开始-->
<script language="javascript">
var province = '$add_rt[0]';
var city  = '$add_rt[1]';
var sh_name = '$order_info[sh_name]';
var kg    = {$goods_rt['sum']['kg']};
var price = {$goods_rt['sum']['price']};
$(function(){
$("#province").change(function(e){
 get_ship();
});
$("#city").change(function(e){
get_ship();
});
get_ship();
//运 费
$("#ship_cart").click(function(e){
if($('input[@name=area_id][@checked]').val()){
$.getJSON(
 "ajax.php",
 {action:"ship_price",total_kg:{$goods_rt['sum']['kg']},total_price:{$goods_rt['sum']['price']},area_id:$('input[@name=area_id][@checked]').val(),rand:Math.random()},
function(json){
$("#sh_exes").attr("value",parseFloat(json).toFixed(2));
});
}
});
//包装
$("#pack_cat").click(function(e){
if($('input[@name=casing_id][@checked]').val()){
$.getJSON("ajax.php?action=pack_price&total_price={$goods_rt['sum']['price']}&date=$m_now_time&casing_id="+$('input[@name=casing_id][@checked]').val(),
function(json){
$("#cas_exes").attr("value",parseFloat(json).toFixed(2));
});
}
});
//添加商品
$("#add_goods").click(function(e){
$("#order_goods").load("admincp.php?module=order&action=up_goods&per=add&order_id=$order_info[uid]"+"&date="+Math.random());
});

});
//更新商品属性
function up_attr(order_id,goods_id,uid){
$.getJSON(
"admincp.php",
{module:"order",action:"up_goods",per:'attr',goods_attr:$('#attr_'+uid).val(),order_id:order_id,goods_id:goods_id,uid:uid,rand:Math.random()},
function(json){
if(json.err!=0){
alert(json.err);
}
});
}
//更新商品价格信息/
function up_price(order_id,goods_id,uid){
$.getJSON(
"admincp.php",
{module:"order",action:"up_goods",goods_price:$('#price_'+uid).val(),order_id:order_id,goods_id:goods_id,uid:uid,rand:Math.random()},
function(json){
if(json.err==0){
$('#order_price').html(json.order_amount);
$('#order_amount').html(json.order_amount);
$('#order_amount').html(json.order_amount);
$('#cess_price').html(json.cess_price);
$('#goods_amount').html(json.goods_amount);
}else {
 alert(json.err);
}
});
}
//更新商品数量信息
function up_nums(order_id,goods_id,uid){
if($('#nums_'+uid).val()<=0){
return false;
}
$.getJSON(
"admincp.php",
{module:"order",action:"up_goods",per:"nums",goods_nums:$('#nums_'+uid).val(),order_id:order_id,goods_id:goods_id,uid:uid,rand:Math.random()},
function(json){
if(json.err==0){
$('#order_price').html(json.order_amount);
$('#order_amount').html(json.order_amount);
$('#order_amount').html(json.order_amount);
$('#cess_price').html(json.cess_price);
$('#goods_amount').html(json.goods_amount);
$('#goods_nums').html(json.nums);
$('#goods_point').html(json.point);
$('#goods_ship').html(currency(parseFloat(json.sh_exes)));
$("#sh_exes").attr("value",parseFloat(json.sh_exes).toFixed(2));
kg = json.kg;
price = json.goods_amount;
get_ship();
}else {
 alert(json.err);
}
});
}
//删除商品
function remove_goods(id,url){
$("#alert_msg").html('确定要删除吗？');
$.blockUI({ message: $('#question'), css: {width: '275px' } });
$('#yes').click(function() {
$.blockUI({ message: '<img src="images/admincp/busy.gif" /> Loading...' });
$.getJSON(
url,
{rand:Math.random()},
function(json){
if(json.err==0){
 $('#r'+id).remove(); 
$('#order_price').html(json.order_amount);
$('#order_amount').html(json.order_amount);
$('#order_amount').html(json.order_amount);
$('#cess_price').html(json.cess_price);
$('#goods_amount').html(json.goods_amount);
$('#goods_nums').html(json.nums);
$('#goods_point').html(json.point);
$('#goods_ship').html(currency(parseFloat(json.sh_exes)));
$("#sh_exes").attr("value",parseFloat(json.sh_exes).toFixed(2));
kg = json.kg;
price = json.goods_amount;
get_ship();
}else {
 alert(json.err);
}
$.unblockUI();
});
});
$('#no').click(function() {
$.unblockUI();
});
}

//货币符号替换
function currency(price){
    var mm_price_length = $mm_price_length;
    var mm_price_sign   = '$mm_price_sign';
    if(mm_price_length==1){
     return  mm_price_sign + price.toFixed(2);
    }else{
     return   mm_price_sign+price;
    }
}

function get_ship(){
    $.getJSON(
    "ajax.php",
    {action:"ship",kg:kg,price:price,province:$('#province').val(),city:$('#city').val(),rand:Math.random()},
    function(json){
    if(json==''){
    alert('该地区没有配送方式');
    $("#province").attr("value",province);
    initcity();
    $("#city").attr("value",city);
    return false;
    }
    $("#ship_cart").html('');
    $.each(json,function(i){
    if(sh_name==json[i].name){
    var checked = 'checked';
    }else{
     var checked = null;
    }
    $('#ship_cart').append("<input type='radio' name='area_id'  value='"+json[i].area_id+"'"+checked+" >"+json[i].name +" "+json[i].exes+"<br/>");
    })
    })
}
</script> 
<div id="right">
	<table class="clst" align="center" cellpadding="0" cellspacing="1">
		<tr>
			<td class="tleft">$lang[orders_audited]</td>
			<td class="tright"><span class="red">$lang[order_number]: $order_info[ordersn]</span></td>
		</tr>
	</table>
	<table cellpadding="0" cellspacing="1" class="list" id="goods_list">
		<tr>
			<th width="23%">$lang[trade_names]/编码</th>
			<th width="23%">属性</th>
			<th width="14%">$lang[purchase_price]</th>
			<th width="10%">$lang[amount]</th>
            <th width="10%">重量</th>
			<th width="10%">赠送积分</th>
			<th width="10%">$lang[operation]</th>
		</tr>
<!--
EOT;
foreach ($goods as $val){
print <<<EOT
-->		
		<tr  id="r$val[uid]">
			<td class="td1"><a href="#">$val[goods_name]<span style="width:auto;"><img src="$val[goods_file1]" /></span></a><p class="cpsm">编码: $val[goods_code]</p></td>
			<td><textarea name="attr_$val[uid]" id="attr_$val[uid]" onchange="up_attr('$uid','$val[goods_id]','$val[uid]');" cols="15" rows="1" class="text">$val[goods_attr]</textarea></td>
			<td><input type="text"  name="price_$val[uid]" id="price_$val[uid]" onchange="up_price('$uid','$val[goods_id]','$val[uid]');" value="$val[buy_price]" size="10" maxlength="10" class="text" /></td>
			<td><input type="text"  name="nums_$val[uid]" id="nums_$val[uid]" onchange="up_nums('$uid','$val[goods_id]','$val[uid]');" value="$val[buy_number]" size="5" maxlength="10" class="text" /></td>
			<td>$val[goods_kg]</td>
			<td>$val[goods_point]</td>
			<td><a href="javascript:;" onclick="remove_goods('$val[uid]','admincp.php?module=$module&action=delete&goods_id=$val[goods_id]&uid=$val[uid]&order_id=$order_info[uid]');">$lang[remove]</a></td>
		</tr>
<!--
EOT;
} print <<<EOT
-->	
		<tbody id="new_goods"></tbody>			
		<tr >
			<td colspan="7">$lang[total_amount]: <span id="goods_amount">$goods_amount</span> + $lang[transportation_costs]: <span id="goods_ship">$sh_exes</span> + $lang[packaging_costs]: $cas_exes +  发票税额 : <span id="cess_price">$cess_price</span> - 折扣金额：$discount = 订单总金额：<span class="red" id="order_price">$order_amount</span></td>
		</tr>
		<tr >
			<td colspan="7" style="text-align:right; padding-right:10px;">备注：商品价格中已包含属性加价 <a href="javascript:;" id="add_goods" class="but1">添加订单商品</a> $lang[total_merchandise]: <span id="goods_nums">{$goods_rt['sum']['nums']}</span> $lang[total_points]: <span class="tip_point" id="goods_point">{$goods_rt['sum']['point']}</span></td>
		</tr>
	</table>
	<div id="order_goods"></div>	
	<form name="order" action="" method="post" id="order">
	<input type="hidden" name="action" value="$action"/>
	<input type="hidden" name="setp" value="1"/>
	<input type="hidden" name="uid" value="$order_info[uid]"/>		
	<table cellpadding="0" cellspacing="1" class="list1" style="margin-top:10px;">
		<tr>
			<th width="4%">ID</th>
			<th width="56%">$lang[information_delivery]</th>
			<th>$lang[operation]</th>
		</tr>
		<tr >
			<td>1</td>
			<td class="td_left1">$lang[single_shipment]</td>
			<td><input type="text" name="order_row[delivery_code]" id="order_row[delivery_code]" value="$order_info[delivery_code]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>2</td>
			<td class="td_left1">$lang[name]</td>
			<td><input type="text" name="order_row[consignee]" id="order_row[consignee]" value="$order_info[consignee]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>3</td>
			<td class="td_left1">$lang[phone_number]</td>
			<td><input type="text" name="order_row[tel]" id="order_row[tel]" value="$order_info[tel]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>4</td>
			<td class="td_left1">$lang[mobiles]</td>
			<td><input type="text" name="order_row[mobile]" id="order_row[mobile]" value="$order_info[mobile]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>5</td>
			<td class="td_left1">$lang[email_consignee]</td>
			<td><input type="text" name="order_row[email]" id="order_row[email]" value="$order_info[email]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>6</td>
			<td class="td_left1">$lang[shipping_address]</td>
			<td>
			<script src="include/javascript/initcity.js"></script>
            <select onchange="initcity();" id="province" name="province">
            <script>creatprovince('$add_rt[0]');</script>
            </select>
            <select name="city" id="city"><script>initcity('$add_rt[1]');</script></select>
            <input name="address" type="text" class="text" id="address" value="$add_rt[2]" maxlength="200" />
			</td>
		</tr>
		<tr >
			<td>7</td>
			<td class="td_left1">$lang[pc_shipments]</td>
			<td><input type="text" name="order_row[zipcode]" id="order_row[zipcode]" value="$order_info[zipcode]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>8</td>
			<td class="td_left1">$lang[distribution_methods]</td>
			<td><span id="ship_cart"></span></td>
		</tr>
		<tr >
		  <td>9</td>
		  <td class="td_left1">$lang[transportation_costs]</td>
		  <td><input type="text" name="sh_exes" id="sh_exes" value="$order_info[sh_exes]" size="30" maxlength="255" class="text" /></td>
	  </tr>
		<tr  id="pack_cat">
			<td>10</td>
			<td class="td_left1">$lang[packaging_choice]</td>
			<td>
<!--
EOT;
foreach ($cache->get_cache('pack') as $val){
$val['check'] = $val['name'] == $order_info['cas_name'] ? 'checked' :'';
print <<<EOT
-->
					<input type="radio" name="casing_id"  value="$val[id]" $val[check]/> $val[name] : $val[price] $lang[fee]:$val[fee] $val[photo]<br/>
<!--
EOT;
} print <<<EOT
-->
			
			</td>
		</tr>
		<tr >
		  <td>11</td>
		  <td class="td_left1">$lang[packaging_costs]</td>
		  <td><input type="text" name="cas_exes" id="cas_exes" value="$order_info[cas_exes]" size="30" maxlength="255" class="text" /></td>
	  </tr>
	</table>
	
		
	<table cellpadding="0" cellspacing="1" class="list1">
		<tr>
			<th width="4%">ID</th>
			<th width="56%">$lang[ordering_info]</th>
			<th>$lang[operation]</th>
		</tr>
		<tr >
			<td>1</td>
			<td class="td_left1">$lang[member_id]</td>
			<td><input type="text" name="order_row[username]" id="order_row[username]" value="$order_info[username]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>2</td>
			<td class="td_left1">$lang[order]</td>
			<td><input type="text" name="order_row[buy_name]" id="order_row[buy_name]" value="$order_info[buy_name]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>3</td>
			<td class="td_left1">$lang[email]</td>
			<td><input type="text" name="order_row[buy_email]" id="order_row[buy_email]" value="$order_info[buy_email]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>4</td>
			<td class="td_left1">$lang[phone_number]</td>
			<td><input type="text" name="order_row[buy_tel]" id="order_row[buy_tel]" value="$order_info[buy_tel]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>5</td>
			<td class="td_left1">$lang[mobiles]</td>
			<td><input type="text" name="order_row[buy_mobile]" id="order_row[buy_mobile]" value="$order_info[buy_mobile]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>6</td>
			<td class="td_left1">$lang[address]</td>
			<td><input type="text" name="order_row[buy_address]" id="order_row[buy_address]" value="$order_info[buy_address]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>7</td>
			<td class="td_left1">$lang[zip]</td>
			<td><input type="text" name="order_row[buy_zipcode]" id="order_row[buy_zipcode]" value="$order_info[buy_zipcode]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>8</td>
			<td class="td_left1">$lang[first_invoice]</td>
			<td><input type="text" name="order_row[invoice]" id="order_row[invoice]" value="$order_info[invoice]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>9</td>
			<td class="td_left1">$lang[note_message]</td>
			<td><textarea name="order_row[remark]" id="order_row[[remark]" cols="35" rows="5" class="text">$order_info[remark]</textarea></td>
		</tr>
	</table>
	
		
	<table cellpadding="0" cellspacing="1" class="list1">
		<tr>
			<th width="4%">ID</th>
			<th width="56%">$lang[billing_information]</th>
			<th>$lang[operation]</th>
		</tr>
		<tr >
			<td>1</td>
			<td class="td_left1">$lang[state_orders]
			  <p class="cpsm">$lang[state_msg].</p>
			  <p class="cpsm">$lang[state_msg1].</p>
		  </td><td>
			$order_menu
			</td>
		</tr>
		<tr >
			<td>2</td>
			<td class="td_left1">$lang[total_yuan]</td>
			<td class="red" ><span id="order_amount">$order_info[order_amount]</span></td>
		</tr>
		<tr >
			<td>3</td>
			<td class="td_left1">折扣金额</td>
			<td><input type="text" name="order_row[discount]" id="order_row[discount]" value="$order_info[discount]" size="30" maxlength="255" class="text" /></td>
		</tr>
		<tr >
			<td>4</td>
			<td class="td_left1">$lang[notes_admin]
		  <p class="cpsm">$lang[total_yuanmsg].</p></td><td><textarea name="order_row[admin_memo]" id="order_row[admin_memo]" rows="5" cols="35" class="text">$order_info[admin_memo]</textarea></td>
		</tr>
	</table>
	<div id="tfoot">
	  	<input type="submit" name="Submit" value="&nbsp;$lang[submit]&nbsp;" onclick="" />
	  	<input type="reset" name="reset" value="&nbsp;$lang[reset]&nbsp;" />
	</div>
  </form>	
</div>
<!-- end -->
<!--
EOT;
?>-->